#include "kdcvts.h"

#include <KLocale>
#include <KIcon>
#include <kdclib.h>

KDCVTS::KDCVTS( KDCObject *aParent ) : KDCObject( KDC::VTS, aParent )
{

}

KDCVTS::~KDCVTS()
{
	for( int i=0; i<pMovies.size(); ++i )
		deletePtr( pMovies.at( i ) );
}

KIcon KDCVTS::icon() const
{
	return KIcon("folder-yellow");
}

QString KDCVTS::title() const
{
	return i18n("Video Title Set ( %1 )").arg( pMovies.size() );
}

void KDCVTS::add( KDCMovie *aMovie )
{
	aMovie->setParent( this );
	pMovies.append( aMovie );
}

void KDCVTS::remove( int aIndex )
{
	if ( isInRange( aIndex, 0, pMovies.size() - 1 ) )
	{
		pMovies.at( aIndex )->setParent( NULL );
		pMovies.removeAt( aIndex );
	}
}

void KDCVTS::move( int aFrom, int aTo )
{
	if ( isInRange( aFrom, 0,pMovies.size() - 1 ) && isInRange( aTo, 0,pMovies.size() - 1 ) )
		pMovies.move( aFrom, aTo );
}

const QList<KDCMovie*>& KDCVTS::movies() const
{
	return pMovies;
}
